<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xml:lang="pt" lang="pt-br">

<f:view contentType="text/html">
	<h:head>
		<f:facet name="first">
			<meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
			<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
			<title>Sos:Editar</title>
		</f:facet>
		<h:outputStylesheet name="css/default.css" />
		<h:outputStylesheet name="css/estilo.css" />
	</h:head>
	<h:body>
		<div id="global">
			<p:layout fullPage="true">
			
				<p:layoutUnit id="bottom" position="south" size="30">
					<ui:include src="../rodape.xhtml" />
				</p:layoutUnit>
				
				<p:layoutUnit id="center" position="center">
				
					<div id="menu">
						<ui:include src="../menu.xhtml" />
					</div>
					
					<div id="corpo">
						<p:growl id="growl" showDetail="false" sticky="true" />
						
						<h:form>
							<p:panel header="Cadastro de Usuario" id="panelcorpo">
								<h:panelGrid>

									<h:inputHidden id="idUsuario" value="#{usuarioManager.usuario.id}" />
									
									<h:outputText value="Nome: " />
									<p:inputText value="#{usuarioManager.usuario.nome}"
										required="true" label="Nome" />

									<h:outputText value="E-mail: " />
									<p:inputText value="#{usuarioManager.usuario.email}"
										required="true" label="E-mail">
										<f:ajax event="blur" listener="#{usuarioManager.validaEmail}"
											render="emailException" />
									</p:inputText>
									
									<h:outputText id="emailException"
										value="#{usuarioManager.msgEmailException}" />

									<h:outputText value="Cargo: " />
									<h:selectOneMenu effect="fade" required="true"
										label="Cargo"
										value="#{usuarioManager.tipoUsuario}">
										<f:selectItem itemLabel="selecione" itemValue="" />
										<f:selectItem itemLabel="Administrador" itemValue="1" />
										<f:selectItem itemLabel="Atendente" itemValue="2" />
										<f:selectItem itemLabel="Professor" itemValue="3" />
									</h:selectOneMenu>

									<h:outputText value="Senha: " />
									<p:password value="#{usuarioManager.usuario.senha}"
										required="true" promptLabel="Digite uma senha segura" 
										weakLabel="Razoável"
										goodLabel="Boa" 
										strongLabel="Ótima"
										feedback="true" 
										maxlength="15"
										requiredMessage="O campo senha deve conter no minimo 6 caracteres."
										match="pwd2"
										validatorMessage="senha digitada incorretamente"
										redisplay="true" />
										
									<h:outputText value="Confirmar Senha: " />
									<p:password id="pwd2" value="#{usuarioManager.usuario.senha}" feedback="false"
										label="Password 2" required="true" redisplay="true" />

									<p:panelGrid columns="2">
										<p:commandButton value="Salvar"
											action="#{usuarioManager.editar()}" ajax="false"
											update="growl" />
										<p:commandButton value="Voltar"
											action="#{usuarioManager.voltar()}" ajax="false"
											update="growl" />
									</p:panelGrid>
									
								</h:panelGrid>
								<p:message for="panelcorpo" redisplay="false" ></p:message>
							</p:panel>
						</h:form>
					</div>

				</p:layoutUnit>
			</p:layout>
		</div>
	</h:body>

</f:view>
</html>